
function trim(str){
    return str.replace(/(^\s*)|(\s*$)/g,"");
  }

function submitValues(){
	
	if(document.getElementById('org_name').value == ''){
		alert('请填写部门名称！');
		document.getElementById('org_name').focus();
		return false;
	}

var org_desc = document.addForm.org_desc;
 
 if(org_desc.value.length > 500)
 {
  alert("部门简介不能大于500个字符!");
  return false;
 }
}

function search(){
		document.indexForm.submit();	 
}
	 

function delOneNews(val1,val2){
	var ifdown = document.getElementById('hasdown'+val1);
	if(ifdown !=null && ifdown.value=='1'){
		if(confirm("所选中含有下级部门，删除时下级部门也会一并删除！")){
	    if(window.confirm('确认删除吗？')){
	    	window.location.href='/doTradeReg.do?pkid='+val2+'&bpm_id=4136';
	  	}
    }		
  }	else{
	  if(window.confirm('确认删除吗？')){
	 	  window.location.href='/doTradeReg.do?pkid='+val2+'&bpm_id=4136'; 
	  } 
	}
}
function delIndexInfos(){
	var listsize = document.getElementById('listsize').value;
	var pkid_string = '';
	var down_class = '0';
	for(var i=0;i<listsize;i++){
		if(document.getElementById('checkone'+i).checked){
			pkid_string += document.getElementById('checkone'+i).value+'|';
			var ifdown = document.getElementById('hasdown'+i);
			if(ifdown !=null && ifdown.value=='1'){
			   down_class =1;
			}	
		}
	}
	if(pkid_string == ''){
		alert('请至少选择一条!');
		return false;
	}
	document.getElementById('pkid').value = pkid_string;
	document.indexForm.action='/doTradeReg.do';
	
	if(down_class == 1){
		  if(confirm("所选中含有下级部门，删除时下级部门也会一并删除！")){
		    if(window.confirm('确认删除吗?')){
		    	document.indexForm.submit();
		    }
	    }
	}else {
		 if(window.confirm('确认删除吗?')){
		   document.indexForm.submit();
	   }
	}	
}


